(SST) ShlWAPI.pas Version 1.08

Developer Reference
(SST)ShlWAPI SHStripMneumonic Function
Deletes the ampersand ("&") before a character in a menu, button, or other caption, marking that character as a keyboard shortcut.
Scope
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas).
Syntax
function SHStripMneumonic(pszMenu : LPSTR) : CHAR;
Parameters
pszMenu [in/out] A pointer to the zero-terminated string from which the mnemonic marker is to be removed.
Return Values
If the function was able to successfully delete the marker character (normally a "&") from the string, it returns the character previously marked by it (typically, this is the character immediately following the ampersand). If the function fails or the input string did not contain a mnemonic, it returns a null character (= 0).
Remarks
This function is exported by name as of ShlWAPI.dll version 6.0 under Vista, but according to the declaration and documentation it is supported as of ShlWAPI.dll 5.0 under Windows 2000. However, the accompanying documentation did/does not provide any information on the ordinal(s) by which function(s) can be accessed in versions pror to Vista.
If a mnemonic character is actually removed, the function adjusts the string's length by moving the terminating null character.
The function name is misspelled but is exported by ShlWAPI.dll as spelled on this page ("SHStripMneumonicA" and "SHStripMneumonicW").
SHStripMneumonicA may be accssible as ordinal 203, SHStripMneumonicW as ordinal 225.
Example
PROCEDURE TForm4.TestShlWAPISHStripMneumonic(Sender : TObject); VAR mnuitemcaption : STRING; VAR apiretval : CHAR; VAR newinfoline : STRING; BEGIN mnuitemcaption := ''; apiretval := #0; newinfoline := ''; //ShowMessage('SHStripMneumonic'); mnuitemcaption := MMHelpAbout.Caption; newinfoline := 'The caption of the "Help -> About" is menu item : ' + mnuitemcaption; Memo1.Lines.Add(newinfoline); apiretval := SHStripMneumonic(PChar(mnuitemcaption)); IF apiretval <> #0 THEN BEGIN newinfoline := 'The caption from which mnemonic was removed is now "' + PChar(mnuitemcaption) + '".';; Memo1.Lines.Add(newinfoline); newinfoline := 'The character from which the mnemonic was stripped is : "' + apiretval + '"'; END ELSE BEGIN newinfoline := 'Stripping the mnemonic from "' + mnuitemcaption + '" failed !'; END; Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END;
Note, that depending on the shell's version and configuration, the mnemonic character may not be displayed, unless the application's menu is activated by means of the keyboard.
The caption of the "Help -> About" menu item is : &About ... The caption from which mnemonic was removed is now "About ...". The character from which the mnemonic was stripped is : "A"
Requirements
Unit: Declared and imported in (SST)ShlWAPI.pas
Library: (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj
Unicode: Implemented as ANSI (SHStripMneumonic and SHStripMneumonicA) and Unicode (SHStripMneumonicW) functions.
Min. ShlWAPI.dll version according to MS SDK doc.: 5.0
Min. ShlWAPI.dll version based on SST research: 5.0
Min. OS version(s) according to Microsoft SDK doc.: Windows 2000, Windows 2000 Server, Windows Server 2003, Windows XP
Min. OS version(s) according to SST research.: Windows 95 with IE 5.0, Windows NT 4.0 with IE 5.0
See Also
StrTrim
 
Windows APIs: SHStripMneumonic, StrTrim


Document/Contents version 1.00
Page/URI last updated on 07.12.2023
 
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to:
webmaster@stoelzelsoftwaretech.com